package jumpingnotes.model.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "record_album", catalog = "jumping_notes")
public class RecordAlbum implements java.io.Serializable
{

	private Integer recordAlbumId;
	private Book book;
	private Member member;
	private String name;
	private String intro;
	private Integer activeLevel;
	private Integer albumRating;
	private Integer ratingTotal;
	private Integer ratingCount;
	private Integer publicFlag;
	private Integer publicGroupId;
	private Integer collabFlag;
	private Integer expectRate;
	private Integer playCount;
	private Date createTime;
	private Set<RecordTask> recordTasks = new HashSet<RecordTask>(0);

	public RecordAlbum()
	{
	}

	public RecordAlbum(Book book, Member member, Date createTime)
	{
		this.book = book;
		this.member = member;
		this.createTime = createTime;
	}

	public RecordAlbum(Book book, Member member, String name, String intro, Integer activeLevel, Integer albumRating,
			Integer ratingTotal, Integer ratingCount, Integer publicFlag, Integer publicGroupId, Integer collabFlag,
			Integer expectRate, Integer playCount, Date createTime, Set<RecordTask> recordTasks)
	{
		this.book = book;
		this.member = member;
		this.name = name;
		this.intro = intro;
		this.activeLevel = activeLevel;
		this.albumRating = albumRating;
		this.ratingTotal = ratingTotal;
		this.ratingCount = ratingCount;
		this.publicFlag = publicFlag;
		this.publicGroupId = publicGroupId;
		this.collabFlag = collabFlag;
		this.expectRate = expectRate;
		this.playCount = playCount;
		this.createTime = createTime;
		this.recordTasks = recordTasks;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "record_album_id", unique = true, nullable = false)
	public Integer getRecordAlbumId()
	{
		return this.recordAlbumId;
	}

	public void setRecordAlbumId(Integer recordAlbumId)
	{
		this.recordAlbumId = recordAlbumId;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "book_id", nullable = false)
	public Book getBook()
	{
		return this.book;
	}

	public void setBook(Book book)
	{
		this.book = book;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "member_id", nullable = false)
	public Member getMember()
	{
		return this.member;
	}

	public void setMember(Member member)
	{
		this.member = member;
	}

	@Column(name = "name")
	public String getName()
	{
		return this.name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	@Column(name = "intro", length = 65535)
	public String getIntro()
	{
		return this.intro;
	}

	public void setIntro(String intro)
	{
		this.intro = intro;
	}

	@Column(name = "active_level")
	public Integer getActiveLevel()
	{
		return this.activeLevel;
	}

	public void setActiveLevel(Integer activeLevel)
	{
		this.activeLevel = activeLevel;
	}

	@Column(name = "album_rating")
	public Integer getAlbumRating()
	{
		return this.albumRating;
	}

	public void setAlbumRating(Integer albumRating)
	{
		this.albumRating = albumRating;
	}

	@Column(name = "rating_total")
	public Integer getRatingTotal()
	{
		return this.ratingTotal;
	}

	public void setRatingTotal(Integer ratingTotal)
	{
		this.ratingTotal = ratingTotal;
	}

	@Column(name = "rating_count")
	public Integer getRatingCount()
	{
		return this.ratingCount;
	}

	public void setRatingCount(Integer ratingCount)
	{
		this.ratingCount = ratingCount;
	}

	@Column(name = "public_flag")
	public Integer getPublicFlag()
	{
		return this.publicFlag;
	}

	public void setPublicFlag(Integer publicFlag)
	{
		this.publicFlag = publicFlag;
	}

	@Column(name = "public_group_id")
	public Integer getPublicGroupId()
	{
		return this.publicGroupId;
	}

	public void setPublicGroupId(Integer publicGroupId)
	{
		this.publicGroupId = publicGroupId;
	}

	@Column(name = "collab_flag")
	public Integer getCollabFlag()
	{
		return this.collabFlag;
	}

	public void setCollabFlag(Integer collabFlag)
	{
		this.collabFlag = collabFlag;
	}

	@Column(name = "expect_rate")
	public Integer getExpectRate()
	{
		return this.expectRate;
	}

	public void setExpectRate(Integer expectRate)
	{
		this.expectRate = expectRate;
	}

	@Column(name = "play_count")
	public Integer getPlayCount()
	{
		return this.playCount;
	}

	public void setPlayCount(Integer playCount)
	{
		this.playCount = playCount;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 19)
	public Date getCreateTime()
	{
		return this.createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "recordAlbum")
	public Set<RecordTask> getRecordTasks()
	{
		return this.recordTasks;
	}

	public void setRecordTasks(Set<RecordTask> recordTasks)
	{
		this.recordTasks = recordTasks;
	}

}
